/**
 * An object representing a map rotation.
 * Provides basic functionality, the rest must be implemented in a child of this object.
 * 
 * @author Paul Redert
 * 
 * author: Paul Redert
 * license: GPLV3
 * 
 * GoldenAK Bot - code.google.com/p/goldenak-bot
 * 
 */

package eu.goldenak.ircbot.game;

import java.util.Vector;

public class Rotation {
	
	/**
	 * The maps in this rotation.
	 */
	private Vector<Map> maps;
		
	/**
	 * Adds map as last in the rotation.
	 * @param map
	 */
	public void addMap(Map map){
		maps.add(map);
	}
	
	/**
	 * Adds map at a specific point in the rotation.
	 */
	public void addMap(Map map, int i){
		maps.add(i, map);
	}
	
	/**
	 * Replaces the map with the map given.
	 */
	public void replaceMap(Map oldMap, Map newMap){
		maps.set(maps.indexOf(oldMap), newMap);
	}
	
	/**
	 * Removes first occurrence of this map.
	 * @param map the map to remove from this rotation
	 */
	public void removeMap(Map map){
		maps.remove(map);
	}
	
	/**
	 * Removes map at specified position.
	 * @param position the position of the map to be removed
	 */
	public void removeMap(int i){
		maps.remove(i);
	}
	
	/**
	 * Returns an array of the map objects contained in this rotation. 
	 */
	public Map[] toList(){
		return (Map[]) maps.toArray();
	}
	
	// TODO create default implementation, need example
	/**
	 * Creates a string of this rotation, formatted so it can be used with a game.
	 * @return
	 */
	public String toString(){
		return null;
	}
		
}